package ma.fizazi.missionsmanagement.presentation.components;

import java.beans.PropertyEditorSupport;

import ma.fizazi.missionsmanagement.business.clients.ContactBusiness;
import ma.fizazi.missionsmanagement.model.Contact;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ContactEditor extends PropertyEditorSupport{
	
	@Autowired
	ContactBusiness contactBusiness;
    

    // Converts a String to a Profil (when submitting form)    
	@Override
    public void setAsText(String text) {
        //Country c = this.countryService.findById(Long.valueOf(text));
        Contact contact = this.contactBusiness.getContactById(Integer.valueOf(text));
        this.setValue(contact);
    }
}
